package com.ruoyi.sms.manager.impl;

import com.ruoyi.sms.entity.SendReq;
import com.ruoyi.sms.entity.SmsResponse;
import com.ruoyi.sms.manager.ISmsManager;
import com.ruoyi.sms.strategy.ISendStrategy;
import com.ruoyi.sms.strategy.SendStrategyContent;
import org.springframework.stereotype.Service;

@Service
public class SmsManagerImpl implements ISmsManager {

    /**
     * 选择发送短信厂商，获取对应的发送策略对象
     * @param sendReq
     * @return
     */
    @Override
    public SmsResponse sendChoose(SendReq sendReq) {
        ISendStrategy strategy = SendStrategyContent.sendStrategyMap.get(sendReq.getProviderCode());
        if (strategy == null){
            return SmsResponse.error("获取发送策略失败！");
        }
        return strategy.toSendCore(sendReq);
    }

    @Override
    public SmsResponse getSmsInfo(SendReq sendReq) {
        return null;
    }
}
